<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Microsoft YaHei:300,300italic,400,400italic,700,700italic|Inziu Iosevka Slab SC:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="The systematic approach to ECG interpretation">
<meta property="og:type" content="article">
<meta property="og:title" content="The ECG Course">
<meta property="og:url" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/index.html">
<meta property="og:site_name" content="苦舟">
<meta property="og:description" content="The systematic approach to ECG interpretation">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106185055308.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106200553151.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106190004559.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106195536709.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106192706879.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106195942621.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106200030445.png">
<meta property="og:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106200108407.png">
<meta property="og:updated_time" content="2017-11-22T15:33:54.618Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="The ECG Course">
<meta name="twitter:description" content="The systematic approach to ECG interpretation">
<meta name="twitter:image" content="http://idmk.oschina.io/2017/11/06/The-ECG-Course/assets/markdown-img-paste-20171106185055308.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://idmk.oschina.io/2017/11/06/The-ECG-Course/"/>





  <title>The ECG Course | 苦舟</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">苦舟</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">学海无涯，吾将上下求索。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://idmk.oschina.io/2017/11/06/The-ECG-Course/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="东木金">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苦舟">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">The ECG Course</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-11-06T14:08:42+08:00">
                2017-11-06
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>The systematic approach to ECG interpretation<br><a id="more"></a></p>
<h2 id="Content"><a href="#Content" class="headerlink" title="Content"></a>Content</h2><p>Primer:</p>
<ul>
<li><a href="http://en.ecgpedia.org/index.php?title=Introduction" target="_blank" rel="external">Introduction</a><br>-</li>
</ul>
<h2 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h2><p><a href="http://en.ecgpedia.org/index.php?title=Introduction" target="_blank" rel="external">http://en.ecgpedia.org/index.php?title=Introduction</a></p>
<p>The aim of this course is to enable the student to understand and recognize normal ECGs and interpret abnormalities. The course is divided into two different sections. First the <a href="#Basics">basics</a> will be presented. This is followed by the interpretation of the normal ECG according to the 7+2 step plan:</p>
<ul>
<li>Step 1: Rhythm</li>
<li>Step 2: Rate</li>
<li>Step 3: Conduction (PQ,QRS,QT)</li>
<li>Step 4: Heart axis</li>
<li>Step 5: P wave morphology</li>
<li>Step 6: QRS morphology</li>
<li>Step 7: ST morphology</li>
<li>Step 7+1: Compare the current ECG with a previous one</li>
<li>Step 7+2: Conclusion</li>
</ul>
<p>Note: It is important to realize that not all these steps may be applicable when you encounter ECG abnormalities. If, for example, the rhythm is not sinus in the first step, the algorithm to analyze arrhythmias should be followed. If a Left Bundle Branch Block is present in step 3, ST morphology will be strongly influenced by this defect.<br>Finally the real world is presented through practice ECGs.<br>After you have finished the course you are invited to come back to read more about abnormal ECGs in the ECG textbook.</p>
<h2 id="Basics"><a href="#Basics" class="headerlink" title="Basics"></a>Basics</h2><p><a href="http://en.ecgpedia.org/index.php?title=Basics" target="_blank" rel="external">http://en.ecgpedia.org/index.php?title=Basics</a></p>
<h3 id="How-do-I-begin-to-read-an-ECG"><a href="#How-do-I-begin-to-read-an-ECG" class="headerlink" title="How do I begin to read an ECG?"></a>How do I begin to read an ECG?</h3><ul>
<li>On the top left are the patient’s information, name, sex and date of birth</li>
<li>At the right of that are below each other the Frequency, the conduction times (PQ,QRS,QT/QTc), and the heart axis (P-top axis, QRS axis and T-top axis)</li>
<li>Farther to the right is the interpretation of the ECG written (this may be missing in a ‘fresh’ ECG, but later the interpretation of the cardiologist or computer will be added)</li>
<li>Down left is the ‘paper speed’ (25 mm/s on the horizontal axis), the sensitivity (10mm/mV) and the filter’s frequency (40Hz, filters noise from eg. lights).</li>
</ul>
<h3 id="The-different-ECG-waves"><a href="#The-different-ECG-waves" class="headerlink" title="The different ECG waves"></a>The different ECG waves</h3><p>The P wave is the result of the atrial depolarization. This depolarization starts in the SA (sinoatrial) node. The signal produced by pacemaker cells in the SA node is conducted to the right and left atria. Normal atrial repolarization is not visible on the ECG (but can be visible during atrial infarction and pericarditis).</p>
<p>The QRS complex is the average of the depolarization waves of the inner (endocardial) and outer (epicardial) cardiomyocytes. As the endocardial cardiomyocytes depolarize slightly earlier than the outer layers, a typical QRS pattern occurs (figure).</p>
<p>The T wave represents the repolarization of the ventricles. There is no cardiac muscle activity during the T wave.</p>
<p>One heart beat consists of an atrial depolarization –&gt; atrial contraction –&gt; p-wave, ventricular depolarization –&gt; ventricular contraction –&gt; ORS-complex and the resting phase (including the repolarization during the T-wave) between two heart beats.</p>
<h4 id="The-letters-“Q”-“R”-and-“S”-are-used-to-describe-the-QRS-complex"><a href="#The-letters-“Q”-“R”-and-“S”-are-used-to-describe-the-QRS-complex" class="headerlink" title="The letters “Q”, “R” and “S” are used to describe the QRS complex"></a>The letters “Q”, “R” and “S” are used to describe the QRS complex</h4><p>Q: the first negative deflection after the p-wave. If the first deflection is not negative, the Q is absent.<br>R: the positive deflection<br>S: the negative deflection after the R-wave<br>Small print letters (q, r, s) are used to describe deflections of small amplitude. For example: qRS = small q, tall R, deep S.<br>R`: is used to describe a second R-wave (as in a right bundle branch block)</p>
<h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><p>The origin of the different waves on the ECG.<br>The letters “Q”, “R” and “S” are used to describe the QRS complex.</p>
<h2 id="Sinus-Node-Rhythms-and-Arrhythmias"><a href="#Sinus-Node-Rhythms-and-Arrhythmias" class="headerlink" title="Sinus Node Rhythms and Arrhythmias"></a>Sinus Node Rhythms and Arrhythmias</h2><p>The sinus node (SA) is located in the roof of the right atrium. It is the fastest physiological pacemaker. When the sinus node generates an electrical impulse, the surrounding cells of the right atrium depolarize. Then the cells of the left atrium, the AV (atrioventricular)node, follow, and at last the ventricles are stimulated via the His bundle. see <a href="http://en.ecgpedia.org/index.php?title=Sinus_Node_Rhythms_and_Arrhythmias" target="_blank" rel="external">http://en.ecgpedia.org/index.php?title=Sinus_Node_Rhythms_and_Arrhythmias</a></p>
<p>With this knowledge it is quite simple to recognize normal sinus rhythm on the ECG.</p>
<h3 id="Criteria-for-normal-sinus-rhythm"><a href="#Criteria-for-normal-sinus-rhythm" class="headerlink" title="Criteria for normal sinus rhythm"></a>Criteria for normal sinus rhythm</h3><ul>
<li>A P wave morphology P wave (atrial contraction) precedes every QRS complex</li>
<li>The rhythm is regular, but varies slightly during respirations</li>
<li>The rate ranges between 60 and 100 beats per minute</li>
<li>The P waves maximum height at 2.5 mm in II and/or III</li>
<li>The P wave is positive in I and II, and biphasic in V1</li>
</ul>
<p>As you can see, knowledge of <a href="#heart-rate">heart rate</a> and <a href="#P-wave-morphology">P wave morphology</a> are necessary to determine the rhythm. We have put Rhythm as step 1 as it is of great importance. Arrhythmias include the most life-threatening ECG abnormalities. In most settings, however, the rhythm will be sinus.</p>
<p>If the rhythm is not sinus, the Arrhythmias algorithm should be followed.</p>
<h3 id="A-good-stepwise-approach-to-interpret-the-heart-rhythm"><a href="#A-good-stepwise-approach-to-interpret-the-heart-rhythm" class="headerlink" title="A good stepwise approach to interpret the heart rhythm"></a>A good stepwise approach to interpret the heart rhythm</h3><ul>
<li>Is this my patient’s ECG or is this an artifact? (applies especially in stressfull situations)</li>
<li>What is the ventricular heart rate?<ul>
<li>>100 bpm = tachycardia</li>
<li>&lt;60 bpm = bradycardia</li>
<li>Are there extra beats? -&gt; Ectopic Beats</li>
</ul>
</li>
<li>Find the P waves<ul>
<li>Do you see P waves? Leads II and V1 are often most suitable to find P waves.</li>
<li>What is the rate of the P waves?</li>
<li>What is the P wave morphology?</li>
</ul>
</li>
<li>What is the relationship between P waves and QRS complexes?<ul>
<li>Is there a 1:1 relation between P waves and QRS complexes? If not there may be AV dissociation due to a Ventricular Arrhythmias or AV block</li>
<li>Is every P wave followed by a QRS complex? And every QRS preceded by a P wave?</li>
<li>What is the PR interval and does it change?</li>
</ul>
</li>
<li>What is the QRS width?<ul>
<li>If the QRS &lt; 120ms (i.e. a narrow complex), then it is either a sinus arrhythmia, supraventricular rhythm or a junctional tachycardia. In tachycardias, this flowchart will lead to the right diagnosis.[1]</li>
<li>If the QRS &gt; 120ms it is either a ventricular tachycardia or a supraventricular rhythm with additional bundle branch block. This is a challenging diagnosis. Therefore a flowchart which incoporates the Brugada criteria for VT should be used.[2] Another method to discriminate VT from SVT has been proposed by Vereckei et al.[3]In that paper an excellent review is given on the subject by Dendi and Josephson.[4]</li>
</ul>
</li>
<li>What is the Heart Axis and did it change?<ul>
<li>If the heart axis turns significantly when compared to the heart axis during sinus rhythm a ventricular origin of the rhythm is more likely.</li>
</ul>
</li>
<li>What is the clinical setting?<ul>
<li>A wide complex tachycardia in a hemodynamically unstable 70-year-old man with previous myocardial infarction should be considered a ventricular tachycardia until proven otherwise</li>
<li>A wide complex tachycardia in a 24-year-old woman with recurrent spells of tachycardia that respond to vagal maneuvers is most likely an AVNRT with aberrant conduction.</li>
</ul>
</li>
</ul>
<p><a href="http://en.ecgpedia.org/index.php?title=Sinus_Node_Rhythms_and_Arrhythmias#Sinus_arrhythmias" target="_blank" rel="external">Some variants of sinus rhythm exist</a></p>
<h3 id="总结-1"><a href="#总结-1" class="headerlink" title="总结"></a>总结</h3><p>描述 ECG 图形的外貌</p>
<h2 id="Rate"><a href="#Rate" class="headerlink" title="Rate"></a>Rate</h2><p>What is the heart rate? To answer this question, determine the time between two QRS complexes. Previously, the ECG was printed on a paper strip transported through an ECG writer at the speed of 25 mm/second. Now, digital ECGs are common; however, the method for determining the frequency remains the same. The ECG has a grid with thick lines 5 mm apart (= 0,20 second) and thin lines 1 mm (0,04 second).<br>There are three simple methods to determine the heart rate (HR)<br>see: <a href="http://en.ecgpedia.org/index.php?title=Rate" target="_blank" rel="external">http://en.ecgpedia.org/index.php?title=Rate</a></p>
<h3 id="What-changes-the-frequency-of-the-heart"><a href="#What-changes-the-frequency-of-the-heart" class="headerlink" title="What changes the frequency of the heart?"></a>What changes the frequency of the heart?</h3><p>A number of factors change the heart frequency, including:</p>
<ul>
<li>the (para) sympathic nervous system.<ul>
<li>The sympathic system, e.g. epinephrine, (=adrenalin) increases atrioventricular conduction and contractility (the fight or flight reaction.)</li>
<li>The parasympathic system (nervus vagus,) e.g. acetycholine, decreases the frequency and atrioventricular conduction. The parasympathic system affects mainly the atria.</li>
</ul>
</li>
<li>Cardiac filling increases the frequency.</li>
<li>arrhythmias influence heart rate.</li>
</ul>
<h2 id="Conduction"><a href="#Conduction" class="headerlink" title="Conduction"></a>Conduction</h2><p><img src="assets/markdown-img-paste-20171106185055308.png" alt="waves"></p>
<h3 id="The-PQ-interval"><a href="#The-PQ-interval" class="headerlink" title="The PQ interval"></a>The PQ interval</h3><p>The PQ interval starts at the beginning of the atrial contraction and ends at the beginning of the ventricular contraction.<br>The PQ interval (sometimes referred to as the PR interval as a Q wave is not always present) indicates how fast the action potential is transmitted through the AV node (atrioventricular) from the atria to the ventricles. Measurement should start at the beginning of the P wave and end at the beginning of the QRS segment.</p>
<h4 id="normal"><a href="#normal" class="headerlink" title="normal"></a>normal</h4><p>The normal PQ interval is between 0.12 and 0.20 seconds.</p>
<h4 id="prolonged"><a href="#prolonged" class="headerlink" title="prolonged"></a>prolonged</h4><p>A prolonged PQ interval is a sign of a degradation of the conduction system or increased vagal tone (Bezold-Jarisch reflex), or it can be pharmacologically induced. This is called 1st, 2nd or 3rd degree AV block.</p>
<h4 id="short"><a href="#short" class="headerlink" title="short"></a>short</h4><p>A short PQ interval can be seen in the WPW syndrome in which faster-than-normal conduction exists between the atria and the ventricles.</p>
<p>The PQ duration depends on the conduction velocity in the atria, AV node, His bundle, bundle branches and Purkinje fibers.<br><img src="assets/markdown-img-paste-20171106200553151.png" alt=""></p>
<h3 id="The-QRS-duration"><a href="#The-QRS-duration" class="headerlink" title="The QRS duration"></a>The QRS duration</h3><p>The QRS duration indicates how fast the ventricles depolarize. The normal QRS is &lt; 0.10 seconds</p>
<h4 id="normal-1"><a href="#normal-1" class="headerlink" title="normal"></a>normal</h4><p>The ventricles depolarize normally within 0.10 seconds.</p>
<h4 id="longer"><a href="#longer" class="headerlink" title="longer"></a>longer</h4><p>When this is longer than 110 miliseconds[1], this is a conduction delay. Possible causes of a QRS duration &gt; 110 miliseconds include:</p>
<ul>
<li>Left bundle branch block</li>
<li>Right bundle branch block</li>
<li>Electrolyte Disorders</li>
<li>Idioventricular rhythm and paced rhythm</li>
</ul>
<p>For the diagnosis of LBBB or RBBB QRS duration must be &gt;120 ms.</p>
<h3 id="The-QT-interval"><a href="#The-QT-interval" class="headerlink" title="The QT interval"></a>The QT interval</h3><h4 id="normal-2"><a href="#normal-2" class="headerlink" title="normal"></a>normal</h4><p>The normal QTc (corrected) interval The QT interval indicates how fast the ventricles are repolarized, becoming ready for a new cycle.<br>The normal value for QTc is: below 450ms for men and below 460ms for women as agreed upon by the ACC / HRS.<br>In a recent ACC consensus document an expert writing group suggest that in a hospital setting the upper limit be raised to the 99th percentile of normal: 470ms in males and 480 ms in females, as approximately 10% to 20% of the general population have a QTc &gt; 440m s. For both men and women QTc &gt; 500ms is considered highly abnormal.</p>
<h4 id="short-1"><a href="#short-1" class="headerlink" title="short"></a>short</h4><p>If QTc is &lt; 340ms <a href="http://en.ecgpedia.org/index.php?title=Short_QT_Syndrome" target="_blank" rel="external">short QT syndrome</a> can be considered.</p>
<h4 id="correction"><a href="#correction" class="headerlink" title="correction"></a>correction</h4><p>The QT interval comprises the QRS-complex, the ST-segment, and the T-wave. One difficultly of QT interpretation is that the QT interval gets shorter as the heart rate increases. This problem can be solved by correcting the QT time for heart rate using the Bazett formula:<br><img src="assets/markdown-img-paste-20171106190004559.png" alt="the Bazett formula"><br>Thus at a heart rate of 60 bpm, the RR interval is 1 second and the QTc equals QT/1. The QTc calculator can be used to easily calculate QTc from the QT and the heart rate or RR interval.<br>On modern ECG machines, the QTc is given. However, the machines are not always capable of making the correct determination of the end of the T wave. Therefore, it is important to check the QT time manually.</p>
<p>Alternatives to the Bazzett correction formula are the Fridericia, Framingham and Hodges formulas. The latter two perform better at high heart rates (&gt;100 /min).</p>
<ul>
<li>Fridericia: QTc = QT{HR/60}1/3</li>
<li>Framingham: QTc = QT + 0.154{1 – (60/HR)}</li>
<li>Hodges: QTc = QT + 1.75 (heart rate - 60).</li>
</ul>
<p>Although QT prolongation is potentially lethal, measurement of the QT interval by physicians is not standardized, since different definitions of the end of the T wave exist.[6] Most QT experts define the end of the T wave as the intersection of the steepest tangent line from the end of the T-wave with the base line of the ECG.[7] This leads to the following stepwise approach:</p>
<h4 id="Stepwise-approach-to-correct-measurement-of-the-QT-interval"><a href="#Stepwise-approach-to-correct-measurement-of-the-QT-interval" class="headerlink" title="Stepwise approach to correct measurement of the QT interval"></a>Stepwise approach to correct measurement of the QT interval</h4><ol>
<li>Use lead II. Use lead V5 alternatively if lead II cannot be read.</li>
<li>Draw a line through the baseline (preferably the PR segment)</li>
<li>Draw a tangent against the steepest part of the end of the T wave. If the T wave has two positive deflections, the taller deflection should be chosen. If the T wave is biphasic, the end of the taller deflection should be chosen.</li>
<li>The QT interval starts at the beginning of the QRS interval and ends where the tangent and baseline cross.<br><img src="assets/markdown-img-paste-20171106195536709.png" alt=""></li>
<li>If the QRS duration exceeds 120ms the amount surpassing 120ms should be deducted from the QT interval (i.e. QT=QT-(QRS width-120ms) ).</li>
<li>Calculate QTc according to Bazett: Formule<br><img src="assets/markdown-img-paste-20171106192706879.png" alt=""><br>You can use the <a href="http://en.ecgpedia.org/index.php?title=QTc_calculator" target="_blank" rel="external">QTc calculator</a> for this.</li>
</ol>
<p>During ventricular pacing this method overestimates the QTc. The Framingham formula performs better during pacing, but still overestimates the QTc in sinus rhythm (in the same patient) by about 37-43 msec.</p>
<p>In a pathological prolonged QT time, it takes longer than the normal amount of time for the myocardial cells to be ready for a new cycle. There is a possibility that some cells are not yet repolarized, but that a new cycle is already initiated. These cells are at risk for uncontrolled depolarization, induction of Torsade de Pointes and subsequent Ventricular Fibrillation.</p>
<p>During ventricular pacing this method overestimates the QTc. The Framingham formula performs better during pacing, but still overestimates the QTc in sinus rhythm (in the same patient) by about 37-43 msec.[8]<br>In a pathological prolonged QT time, it takes longer than the normal amount of time for the myocardial cells to be ready for a new cycle. There is a possibility that some cells are not yet repolarized, but that a new cycle is already initiated. These cells are at risk for uncontrolled depolarization, induction of Torsade de Pointes and subsequent Ventricular Fibrillation.</p>
<h4 id="Causes-of-QT-prolongation"><a href="#Causes-of-QT-prolongation" class="headerlink" title="Causes of QT prolongation"></a>Causes of QT prolongation</h4><p>The QT interval is prolonged in congenital long QT syndrome, but QT prolongation can also occur be acquire as a results of:</p>
<ul>
<li>Medication (anti-arrhythmics, tricyclic antidepressants, phenothiazedes, for a complete list see Torsades.org</li>
<li>Electrolyte imbalances</li>
<li>Ischemia.</li>
</ul>
<p>QT prolongation is often treated with beta blockers.</p>
<h4 id="How-to-measure-QT-if-the-QT-segement-is-abnormal"><a href="#How-to-measure-QT-if-the-QT-segement-is-abnormal" class="headerlink" title="How to measure QT if the QT segement is abnormal"></a>How to measure QT if the QT segement is abnormal</h4><p>If the QT segment is abnormal, it can be difficult to define the end of the T wave. Below are a number of examples that suggest how QT should be measured in these patients.</p>
<p>The T wave is broad, but the tangent crosses the baseline before the T wave joins the baseline. The QT interval would be overestimated when this last definition of the end of the T wave would be used.<br><img src="assets/markdown-img-paste-20171106195942621.png" alt=""></p>
<p>The ECG does not meet the baseline after the end of the T wave. Still, the crossing of the tangent and baseline should be used for measurements.<br><img src="assets/markdown-img-paste-20171106200030445.png" alt=""></p>
<p>A bifasic T wave. The tangent to the ‘hump’ with the largest amplitude is chosen. This can change from beat to beat, making it more important to average several measurements.<br><img src="assets/markdown-img-paste-20171106200108407.png" alt=""></p>
<h3 id="总结-2"><a href="#总结-2" class="headerlink" title="总结"></a>总结</h3><h4 id="The-PQ-interval-1"><a href="#The-PQ-interval-1" class="headerlink" title="The PQ interval"></a>The PQ interval</h4><p>The PQ interval indicates how fast the action potential is transmitted through the AV node (atrioventricular) from the atria to the ventricles.<br>The normal PQ interval is between 0.12 and 0.20 seconds.<br>过大，1st, 2nd or 3rd degree AV block.<br>过小，WPW syndrome.</p>
<h4 id="The-QRS-duration-1"><a href="#The-QRS-duration-1" class="headerlink" title="The QRS duration"></a>The QRS duration</h4><p>The QRS duration indicates how fast the ventricles depolarize. The normal QRS is &lt; 0.10 seconds<br>The ventricles depolarize normally within 0.10 seconds. When this is longer than 110 miliseconds[1], this is a conduction delay. Possible causes of a QRS duration &gt; 110 miliseconds include:</p>
<ul>
<li>Left bundle branch block</li>
<li>Right bundle branch block</li>
<li>Electrolyte Disorders</li>
<li>Idioventricular rhythm and paced rhythm</li>
</ul>
<p>For the diagnosis of LBBB or RBBB QRS duration must be &gt;120 ms.</p>
<h2 id="QRS-axis"><a href="#QRS-axis" class="headerlink" title="QRS axis"></a>QRS axis</h2><h3 id="How-do-you-determine-the-electrical-heart-axis"><a href="#How-do-you-determine-the-electrical-heart-axis" class="headerlink" title="How do you determine the electrical heart axis"></a>How do you determine the electrical heart axis</h3><p>Click and drag the arrow in the above animation to change the heart axis and see how the ECG changes.<br>see: <a href="http://en.ecgpedia.org/index.php?title=Heart_axis" target="_blank" rel="external">http://en.ecgpedia.org/index.php?title=Heart_axis</a></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/11/05/ECG-based-heartbeat-classification-for-arrhythmia-detection-A-survey/" rel="next" title="ECG Based Heartbeat Classification for Arrhythmia Detection a Survey">
                <i class="fa fa-chevron-left"></i> ECG Based Heartbeat Classification for Arrhythmia Detection a Survey
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/11/19/How-To-Read-Documents-Efficiently/" rel="prev" title="How to Read Documents Efficiently">
                How to Read Documents Efficiently <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatar.jpg"
               alt="东木金" />
          <p class="site-author-name" itemprop="name">东木金</p>
           
              <p class="site-description motion-element" itemprop="description">正在学习机器学习，希望能变得很强！</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">18</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">42</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/bdmk" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                    
                      GitHub
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="mailto:catcherchan94@outlook.com" target="_blank" title="E-Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Content"><span class="nav-number">1.</span> <span class="nav-text">Content</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Introduction"><span class="nav-number">2.</span> <span class="nav-text">Introduction</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Basics"><span class="nav-number">3.</span> <span class="nav-text">Basics</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#How-do-I-begin-to-read-an-ECG"><span class="nav-number">3.1.</span> <span class="nav-text">How do I begin to read an ECG?</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#The-different-ECG-waves"><span class="nav-number">3.2.</span> <span class="nav-text">The different ECG waves</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#The-letters-“Q”-“R”-and-“S”-are-used-to-describe-the-QRS-complex"><span class="nav-number">3.2.1.</span> <span class="nav-text">The letters “Q”, “R” and “S” are used to describe the QRS complex</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#总结"><span class="nav-number">3.3.</span> <span class="nav-text">总结</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Sinus-Node-Rhythms-and-Arrhythmias"><span class="nav-number">4.</span> <span class="nav-text">Sinus Node Rhythms and Arrhythmias</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Criteria-for-normal-sinus-rhythm"><span class="nav-number">4.1.</span> <span class="nav-text">Criteria for normal sinus rhythm</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#A-good-stepwise-approach-to-interpret-the-heart-rhythm"><span class="nav-number">4.2.</span> <span class="nav-text">A good stepwise approach to interpret the heart rhythm</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#总结-1"><span class="nav-number">4.3.</span> <span class="nav-text">总结</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Rate"><span class="nav-number">5.</span> <span class="nav-text">Rate</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#What-changes-the-frequency-of-the-heart"><span class="nav-number">5.1.</span> <span class="nav-text">What changes the frequency of the heart?</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Conduction"><span class="nav-number">6.</span> <span class="nav-text">Conduction</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#The-PQ-interval"><span class="nav-number">6.1.</span> <span class="nav-text">The PQ interval</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#normal"><span class="nav-number">6.1.1.</span> <span class="nav-text">normal</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#prolonged"><span class="nav-number">6.1.2.</span> <span class="nav-text">prolonged</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#short"><span class="nav-number">6.1.3.</span> <span class="nav-text">short</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#The-QRS-duration"><span class="nav-number">6.2.</span> <span class="nav-text">The QRS duration</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#normal-1"><span class="nav-number">6.2.1.</span> <span class="nav-text">normal</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#longer"><span class="nav-number">6.2.2.</span> <span class="nav-text">longer</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#The-QT-interval"><span class="nav-number">6.3.</span> <span class="nav-text">The QT interval</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#normal-2"><span class="nav-number">6.3.1.</span> <span class="nav-text">normal</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#short-1"><span class="nav-number">6.3.2.</span> <span class="nav-text">short</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#correction"><span class="nav-number">6.3.3.</span> <span class="nav-text">correction</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Stepwise-approach-to-correct-measurement-of-the-QT-interval"><span class="nav-number">6.3.4.</span> <span class="nav-text">Stepwise approach to correct measurement of the QT interval</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Causes-of-QT-prolongation"><span class="nav-number">6.3.5.</span> <span class="nav-text">Causes of QT prolongation</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#How-to-measure-QT-if-the-QT-segement-is-abnormal"><span class="nav-number">6.3.6.</span> <span class="nav-text">How to measure QT if the QT segement is abnormal</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#总结-2"><span class="nav-number">6.4.</span> <span class="nav-text">总结</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#The-PQ-interval-1"><span class="nav-number">6.4.1.</span> <span class="nav-text">The PQ interval</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#The-QRS-duration-1"><span class="nav-number">6.4.2.</span> <span class="nav-text">The QRS duration</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#QRS-axis"><span class="nav-number">7.</span> <span class="nav-text">QRS axis</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#How-do-you-determine-the-electrical-heart-axis"><span class="nav-number">7.1.</span> <span class="nav-text">How do you determine the electrical heart axis</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2017 - 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">东木金</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Gemini
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'manual') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
